import datetime
import time
# 获取当前时间
now_time = datetime.datetime.now()
print(now_time)

# 时间的加减
# days=天, seconds=秒, minutes=分钟, hours=小时, weeks=周
a = now_time + datetime.timedelta(weeks=3)
print(a)

# 时间的替换
# days=天, seconds=秒, minutes=分钟, hours=小时, weeks=周
b = a.replace(year=1999)  # 将年份修改为1999
print(b)


# 将时间戳修改为日期格式
c = datetime.date.fromtimestamp(time.time())
print(c)

